/**
 * Created by Administrator on 2015/1/5.
 */

var lastElement = null;
var hoverColor = "#e9e9e9";
var oldColor = "#ffffff";
var clickColor = "#57baf5";
function initHover(element, isClick) {
    element.mouseenter(function () {
        if (lastElement != this)
            $(this).css("background-color", hoverColor);
    });
    element.mouseleave(function () {
        if (lastElement != this)
            $(this).css("background-color", oldColor);
    });
    if (isClick == true) {
        element.click(function () {
            $(this).css("background-color", clickColor);
            if (lastElement != null && lastElement != this) {
                $(lastElement).css("background-color", oldColor);
            }
            lastElement = this;
        });
    }
}
